<% layout('/layouts/default.html', {title: '合同表管理', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa fa-list-alt"></i> 合同表管理
			</div>
			<div class="box-tools pull-right">
				<a href="#" class="btn btn-default" id="btnSearch" title="查询"><i class="fa fa-filter"></i> 查询</a>
				<% if(hasPermi('fty:ftyLeaseContractSmart:edit')){ %>
					<a href="${ctx}/fty/ftyLeaseContractSmart/form" class="btn btn-default btnTool" title="新增合同表"><i class="fa fa-plus"></i> 新增</a>
				<% } %>
			</div>
		</div>
		<div class="box-body">
			<#form:form id="searchForm" model="${ftyLeaseContractSmart}" action="${ctx}/fty/ftyLeaseContractSmart/listData" method="post" class="form-inline hide"
					data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
				<div class="form-group">
					<label class="control-label">合同编号：</label>
					<div class="control-inline">
						<#form:input path="cNumber" maxlength="32" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">status：</label>
					<div class="control-inline width-120">
						<#form:select path="status" dictType="sys_search_status" blankOption="true" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">remarks：</label>
					<div class="control-inline">
						<#form:input path="remarks" maxlength="64" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">出租方：</label>
					<div class="control-inline">
						<#form:input path="aName" maxlength="32" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">受租方：</label>
					<div class="control-inline">
						<#form:input path="bName" maxlength="32" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">中介方：</label>
					<div class="control-inline">
						<#form:input path="cName" maxlength="32" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">房屋地址：</label>
					<div class="control-inline">
						<#form:input path="hAddess" maxlength="32" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">建筑面积：</label>
					<div class="control-inline">
						<#form:input path="hArea" maxlength="32" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">室内设施：</label>
					<div class="control-inline">
						<#form:input path="hDecoration" maxlength="32" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">附属用房：</label>
					<div class="control-inline">
						<#form:input path="subRoom" maxlength="32" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">房屋结构：</label>
					<div class="control-inline">
						<#form:input path="hStruts" maxlength="32" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">房屋：</label>
					<div class="control-inline">
						<#form:input path="hFinishTime" maxlength="32" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">房屋结构改造情况：</label>
					<div class="control-inline">
						<#form:input path="transSituation" maxlength="32" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">租凭期限：</label>
					<div class="control-inline">
						<#form:input path="leaseTimeLimit" maxlength="32" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">lease_start：</label>
					<div class="control-inline">
						<#form:input path="leaseStart" readonly="true" maxlength="20" class="form-control Wdate-datetime"
							dataFormat="datetime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',isShowClear:false});"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">lease_end：</label>
					<div class="control-inline">
						<#form:input path="leaseEnd" readonly="true" maxlength="20" class="form-control Wdate-datetime"
							dataFormat="datetime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',isShowClear:false});"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">每月租金：</label>
					<div class="control-inline">
						<#form:input path="rentPerMonth" maxlength="32" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">按 月、季度、年：</label>
					<div class="control-inline">
						<#form:input path="rentSelect" maxlength="32" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">首付：</label>
					<div class="control-inline">
						<#form:input path="hMoneyFirst" maxlength="32" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">首付款结清时间：</label>
					<div class="control-inline">
						<#form:input path="hMoneyFirstTime" readonly="true" maxlength="20" class="form-control Wdate-datetime"
							dataFormat="datetime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',isShowClear:false});"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">结款提前时间：</label>
					<div class="control-inline">
						<#form:input path="moneyAdvance" maxlength="32" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">押金：</label>
					<div class="control-inline">
						<#form:input path="deposit" maxlength="32" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">水电煤气以及：</label>
					<div class="control-inline">
						<#form:input path="hOthers" maxlength="32" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">维修费承担方：</label>
					<div class="control-inline">
						<#form:input path="hExpensPart" maxlength="32" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">租凭房屋用途：</label>
					<div class="control-inline">
						<#form:input path="hUseage" maxlength="32" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">中介费：</label>
					<div class="control-inline">
						<#form:input path="hAgencyFee" maxlength="32" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">中介费付清时间：</label>
					<div class="control-inline">
						<#form:input path="hAgencyTime" maxlength="32" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">交房时间：</label>
					<div class="control-inline">
						<#form:input path="makeHouseTime" readonly="true" maxlength="20" class="form-control Wdate-datetime"
							dataFormat="datetime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',isShowClear:false});"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">违约金：</label>
					<div class="control-inline">
						<#form:input path="penalty" maxlength="32" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">解决途径：</label>
					<div class="control-inline">
						<#form:input path="solveWay" maxlength="32" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<button type="submit" class="btn btn-primary btn-sm">查询</button>
					<button type="reset" class="btn btn-default btn-sm">重置</button>
				</div>
			</#form:form>
			<table id="dataGrid"></table>
			<div id="dataGridPage"></div>
		</div>
	</div>
</div>
<% } %>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	columnModel: [
		{header:'合同编号', name:'cNumber', index:'a.c_number', width:150, align:"left", frozen:true, formatter: function(val, obj, row, act){
			return '<a href="${ctx}/fty/ftyLeaseContractSmart/form?contractCode='+row.contractCode+'" class="btnList" data-title="编辑合同表">'+(val||row.id)+'</a>';
		}},
		{header:'创建时间', name:'createDate', index:'a.create_date', width:150, align:"center"},
		{header:'合同编号', name:'cnumber', index:'a.c_number', width:150, align:"left"},

		{header:'合同生成机构', name:'cname', index:'a.cname', width:150, align:"left"},
		{header:'操作员', name:'createBy', index:'a.create_by', width:150, align:"left"},

		{header:'操作', name:'actions', width:120, sortable:false, title:false, formatter: function(val, obj, row, act) {
			var actions = [];
			console.log(row);
			if ((typeof(row.cnumber)) == undefined||row.cnumber==undefined) {
				row.cnumber = '';
			}
			<% if(hasPermi('fty:ftyLeaseContractSmart:edit')){ %>
				if(row.cnumber!=''){
					actions.push('<a href="${ctx}/fty/ftyLeaseContractSmart/contract?contractCode='+row.contractCode+'" class="btnList" title="查看合同"><i class="fa fa-pencil"></i></a>&nbsp;');
				}else{
					actions.push('<a href="${ctx}/fty/ftyLeaseContractSmart/form?contractCode='+row.contractCode+'" class="btnList" title="编辑合同"><i class="fa fa-pencil"></i></a>&nbsp;');
					actions.push('<a href="${ctx}/fty/ftyLeaseContractSmart/generalNumber?contractCode='+row.contractCode+'" class="btnList" title="生成编号" data-confirm="确认生成合同编号？"><i class="fa fa-home"></i></a>&nbsp;');
					actions.push('<a href="${ctx}/fty/ftyLeaseContractSmart/delete?contractCode='+row.contractCode+'" class="btnList" title="删除合同表" data-confirm="确认要删除该合同表吗？"><i class="fa fa-trash-o"></i></a>&nbsp;');
				}
			<%
			}
			%>
			return actions.join('');
		}}
	],
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});
</script>